import { fileURLToPath, URL } from 'node:url'
import babel from "vite-babel-plugin"

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({

  plugins: [
    vue(),
    babel()
  ],
  server:{
    proxy: {// 跨域代理
      '/apis': {
        target: 'https://mall.yili.com/MAMAIF/MCSWSIAPI.asmx/Call', // 
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/apis/, '')
      },
    },
  },
  base: './',
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
